package svc

import (
	"github.com/zeromicro/go-zero/core/stores/sqlx"
	"t-go-zero/service/user/model"
	"t-go-zero/service/user/rpc/internal/config"
)

type ServiceContext struct {
	Config     config.Config
	ARoleModel model.ARoleModel
}

func NewServiceContext(c config.Config) *ServiceContext {
	// 数据库的连接
	conn := sqlx.NewMysql(c.Mysql.DataSource)
	return &ServiceContext{
		Config:     c,                                       // 配置文件内容
		ARoleModel: model.NewARoleModel(conn, c.CacheRedis), // ARole这张表数据库操作权限
	}
}
